using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;

namespace DebugConsole.Components
{
    class DebugMark
    {
        public Color color;
        public int remainingTime = -1;
        public VertexPositionColor[] mark;
        public Texture2D label;
        private MarkType type;

        public MarkType Type
        {
            get { return type; }
        }

        #region Constructors
        public DebugMark(Vector3 position, Color color, Texture2D label)
        {
            Initialize(position, color, -1, label, MarkType.Cross);
        }

        public DebugMark(Vector3 position, Color color, Texture2D label, MarkType type)
        {
            Initialize(position, color, -1, label, type);
        }

        private void Initialize(Vector3 position, Color color, int time, Texture2D label, MarkType type)
        {
            this.color          = color;
            this.remainingTime  = time;
            this.label          = label;
            this.type           = type;

            if (type == MarkType.Cross)
            {
                mark = new VertexPositionColor[6];
            }
            else
            {
                mark = new VertexPositionColor[1];
            }

            for (int i = 0; i < mark.Length; i++)
                mark[i].Color = color;

            MoveTo(position);
        }
        #endregion

        #region MoveTo
        public void MoveTo(Vector3 position)
        {
            for (int i = 0; i < mark.Length; i++)
                mark[i].Position = position;

            if (this.type == MarkType.Cross)
            {
                mark[0].Position += new Vector3(+0.1f, 0, 0);
                mark[1].Position += new Vector3(-0.1f, 0, 0);
                mark[2].Position += new Vector3(0, -0.01f, 0);
                mark[3].Position += new Vector3(0, +0.01f, 0);
                mark[4].Position += new Vector3(0, 0, -0.1f);
                mark[5].Position += new Vector3(0, 0, +0.1f);
            }
        }
        #endregion
    }
}

